package cn.xuyang520.tyim.sys.service.impl;

import cn.xuyang520.tyim.sys.service.TySysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by admin on 2017/4/4.
 */
@Service("tySysUserService")
public class TySysUserServiceImpl implements TySysUserService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    @Cacheable(value = "tyCache", key = "'auth:groups:' + #p0")
    public List<String> findGroupIdsByCode(String TbId) {
        LinkedList<String> result = new LinkedList<>();
        result.add(jdbcTemplate.queryForObject("SELECT tb_group_code FROM ty_sys_user WHERE tb_id = ?", String.class, TbId));
        System.out.println("查询用户用户组");
        return result;
    }
}
